package bean;

import dao.IDIF;

/**
 * A base class for Blog data manipulation
 * @author Anne Lorayne, Laura Dutra, Otavio Lima
 *
 */
public class BlogBean implements IDIF {
 
	private String title;
	 
	private String description;
	 
	private String Id;
	
	private String owner;
	
	private String lastPostId;
	
	public BlogBean() {} 
	
	/**
	 * Constuctor of the class
	 * @param title 
	 * @param description
	 * @param ID
	 */
	public BlogBean(String title, String description, String ID, String owner){
		this.title = title;
		this.description = description;
		this.Id = ID;
		this.owner = owner;
		this.lastPostId = "0";
	}

	// ------Getters and Setters------
	
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getId() {
		return Id;
	}

	public void setId(String iD) {
		Id = iD;
	}
	
	/**
	 * @return the lastPostId
	 */
	public String getLastPostId() {
		return lastPostId;
	}

	/**
	 * @param lastPostId the lastPostId to set
	 */
	public void setLastPostId(String lastPostId) {
		this.lastPostId = lastPostId;
	}

	public String getOwner(){
		return owner;
	}
	
	public void setOwner(String owner){
		this.owner = owner;
	}
	@Override
	public boolean equals(Object obj) {
		if (obj == null || !(obj instanceof BlogBean) )
			return false;
		BlogBean anotherBlogBean = (BlogBean) obj;
		
		if (this.getId().equals(anotherBlogBean.getId()))
			return true;
		
		return false;
	}
}
 
